Machine Learning: Creating an End to End Solution For Absolute Beginners by Tull Shaun

Machine Learning: Creating an End to End Solution For Absolute Beginners by Tull Shaun

Author:Tull, Shaun [Tull, Shaun]
Language: eng
Format: mobi
Publisher: Coolbullet Publishing
Published: 2018-10-08T16:00:00+00:00


4.7

KNN Hyperparameter Tuning

We will start by looking at the parameter value k for the KNN model, the optimal value for k needs to be identified. In our previous KNN model run, k had run with its default value of 5, to identify its optimal value, we will import the grid search cross validation library from scikit-learn, which is called ‘GridSearchCV’. Using the grid search which takes the parameters available from the KNN model we can now specify the range of values of k which we want to evaluate. We will set the range of k values from 1-31 and the model will evaluate each value of k against the full data set which will be divided into 10 folds, with an even distribution of the class in each fold. The result was measured and scored for accuracy. We can use a plot graph to help visualise the k value and its resulting accuracy, as shown in Plot 1.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.